<?php
require_once "jssdk.php";
$jssdk = new JSSDK("wx409a5223727cfbde", "3750cb321b4965883f1ccbe1fc945f8d");
$signPackage = $jssdk->GetSignPackage();
?>
    <!DOCTYPE HTML>
    <html>

    <head>
        <meta charset="utf-8">
        <title>2017|「远」见未来 ▪「洋」帆起航</title>
        <meta name="viewport" content="width=device-width,initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no" />
        <meta name="apple-mobile-web-app-capable" content="yes" />
        <meta name="full-screen" content="true" />
        <meta name="screen-orientation" content="portrait" />
        <meta name="x5-fullscreen" content="true" />
        <meta name="360-fullscreen" content="true" />
        <style>
        html, body {
            -ms-touch-action: none;
            background: #888888;
            padding: 0;
            border: 0;
            margin: 0;
            height: 100%;
        }
    </style>

<!--这个标签为通过egret提供的第三方库的方式生成的 javascript 文件。删除 modules_files 标签后，库文件加载列表将不会变化，请谨慎操作！-->
<!--modules_files_start-->
	<script egret="lib" src="libs/modules/egret/egret.js" src-release="libs/modules/egret/egret.min.js"></script>
	<script egret="lib" src="libs/modules/egret/egret.web.js" src-release="libs/modules/egret/egret.web.min.js"></script>
	<script egret="lib" src="libs/modules/game/game.js" src-release="libs/modules/game/game.min.js"></script>
	<script egret="lib" src="libs/modules/res/res.js" src-release="libs/modules/res/res.min.js"></script>
	<script egret="lib" src="libs/modules/tween/tween.js" src-release="libs/modules/tween/tween.min.js"></script>
	<script egret="lib" src="libs/modules/particle/particle.js" src-release="libs/modules/particle/particle.min.js"></script>
	<!--modules_files_end-->

<!--这个标签为不通过egret提供的第三方库的方式使用的 javascript 文件，请将这些文件放在libs下，但不要放在modules下面。-->
<!--other_libs_files_start-->
<script egret="lib" src="polyfill/promise.js" src-release="polyfill/promise.min.js"></script>
<script src='http://res.wx.qq.com/open/js/jweixin-1.0.0.js' src-release="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<!--other_libs_files_end-->

<!--这个标签会被替换为项目中所有的 javascript 文件。删除 game_files 标签后，项目文件加载列表将不会变化，请谨慎操作！-->
<!--game_files_start-->
	<script egret="game" src="bin-debug/com/compoment/ScrollEvent.js"></script>
	<script egret="game" src="bin-debug/Main.js"></script>
	<script egret="game" src="bin-debug/com/utils/Interserct.js"></script>
	<script egret="game" src="bin-debug/com/utils/mediator/Mediator.js"></script>
	<script egret="game" src="bin-debug/com/utils/mediator/MediatorEvent.js"></script>
	<script egret="game" src="bin-debug/com/utils/PhoneAction.js"></script>
	<script egret="game" src="bin-debug/com/utils/Tool.js"></script>
	<script egret="game" src="bin-debug/Game.js"></script>
	<script egret="game" src="bin-debug/LoadingUI.js"></script>
	<script egret="game" src="bin-debug/com/compoment/ScrollContainer.js"></script>
	<script egret="game" src="bin-debug/MovieClipData.js"></script>
	<script egret="game" src="bin-debug/Page1.js"></script>
	<script egret="game" src="bin-debug/Page2.js"></script>
	<script egret="game" src="bin-debug/Page3.js"></script>
	<script egret="game" src="bin-debug/Page4.js"></script>
	<script egret="game" src="bin-debug/Page5.js"></script>
	<script egret="game" src="bin-debug/ParticleManager.js"></script>
	<script egret="game" src="bin-debug/SoundManager.js"></script>
	<!--game_files_end-->
</head>

<body>
    <div style="display:none"><img src='suolue.png' width="400" height="400" /></div>
<audio id="Jaudio" class="media-audio" src="resource/assets/bg.mp3" autoplay='autoplay' preload="preload" loop="loop"></audio>
<audio id="effect1" class="media-audio" src="resource/assets/effect1.mp3" autoplay='autoplay' preload="preload"></audio>
<audio id="effect2" class="media-audio" src="resource/assets/effect2.mp3" autoplay='autoplay' preload="preload"></audio>
<div style="margin: auto;width: 100%;height: 100%;" class="egret-player" data-entry-class="Main" data-orientation="auto" data-scale-mode="noBorder" data-frame-rate="60" data-content-width="740"
data-content-height="1136" data-show-paint-rect="false" data-multi-fingered="2" data-show-fps="false" data-show-log="false"
data-show-fps-style="x:0,y:0,size:12,textColor:0xffffff,bgAlpha:0.9">
</div>
<script>
    /**
     * {
     * "renderMode":, //引擎渲染模式，"canvas" 或者 "webgl"
     * "audioType": "" //使用的音频类型，0:默认，1:qq audio，2:web audio，3:audio
     * "antialias": //WebGL模式下是否开启抗锯齿，true:开启，false:关闭，默认为false
     * }
     **/
    wx.config({
        debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
        appId: '<?php echo $signPackage["appId"];?>',
        timestamp: '<?php echo $signPackage["timestamp"];?>',
        nonceStr: '<?php echo $signPackage["nonceStr"];?>',
        signature: '<?php echo $signPackage["signature"];?>',
        jsApiList: ['onMenuShareAppMessage']
    });
    wx.ready(function () {
        wx.onMenuShareAppMessage({
            title: '2017|「远」见未来 ▪「洋」帆起航', // 分享标题
            desc: '未来 由你创造', // 分享描述
            link: 'http://www.yixuanhudong.com/YYDC_Ink/index.php', // 分享链接
            imgUrl: 'http://www.yixuanhudong.com/YYDC_Ink/suolue.png',
            type: 'link', // 分享类型,music、video或link，不填默认为link
            success: function () {
                alert("分享成功！");
            },
            cancel: function () {
                // 用户取消分享后执行的回调函数
            }
        });
        wx.error(function (res) {

            // config信息验证失败会执行error函数，如签名过期导致验证失败

        });
    });


    var audio;
    var audio1;
    var audio2;
    function playMusic() {
        audioAutoPlay('Jaudio');
    }
    function playMusicEffect1() {
        audioAutoPlay('effect1');
    }
    function playMusicEffect2() {
        audioAutoPlay('effect2');
    }


    function audioAutoPlay(id) {
        if (id == 'Jaudio') {
            audio = document.getElementById(id);
            audio.play();
            audio.pause();
        }
        else if (id == 'effect1') {
            audio1 = document.getElementById(id);
            audio1.play();
            audio1.pause();
        }
        else if (id == 'effect2') {
            audio2 = document.getElementById(id);
            audio2.play();
            audio2.pause();
        }
        // audio = document.getElementById(id);
        // audio.play();
        // audio.pause();
    }


    function StartMusic() {
        document.addEventListener("WeixinJSBridgeReady", playMusic, false);
    }
    function playEffect1() {
        document.addEventListener("WeixinJSBridgeReady", playMusicEffect1, false);
    }
    function playEffect2() {
        document.addEventListener("WeixinJSBridgeReady", playMusicEffect2, false);
    }

    function MusicOnOff(bl, id) {
        if (bl) {
            audio = document.getElementById(id)
            if (audio) {
                audio.play();
                audio.volume = 1;
            }

        }
        else {
            audio = document.getElementById(id)
            if (audio) {
                audio.pause();
                audio.volume = 0;
            }
        }
    }

    StartMusic();
    playEffect1();
    playEffect2();
    egret.runEgret({ renderMode: "webgl", audioType: 0 });
</script>
</body>

</html>